﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Theme_3_Refer :PowerCreator.LMS.Web.Base.WebBasePage
{
    PowerCreator.LMS.Web.Refer.Refer opRefer = new PowerCreator.LMS.Web.Refer.Refer();
    protected PowerCreator.LMS.Web.Config.WebConfig config = new PowerCreator.LMS.Web.Config.WebConfig();

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = config.GetLanagerValueByKey("theme_menu_Refer", PowerCreator.LMS.Language.LanagetItemType.Page);
        if (!IsPostBack)
        {
            string search = GetSearch();

            BinderPager(search);
            BinderRPT(search, 1);
        }
    }
    protected override void InitPage()
    {
        
        base.InitPage();
    }


    private string GetSearch()
    {
        string search = " ReferState=1";
        return search;
    }

    protected void BinderPager(string search)
    {
        AspNetPager1.RecordCount = opRefer.Count(search);
        AspNetPager1.PageSize = PowerCreator.LMS.Web.Config.WebConfig.PageSize;
        PreAspNetPager(AspNetPager1);
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        string search = GetSearch();
        BinderRPT(search, AspNetPager1.CurrentPageIndex);
    }
    private void BinderRPT(string search, int pageIndex)
    {
        DataTable dt = new DataTable();
        dt = opRefer.Query(search, PowerCreator.LMS.Web.Config.WebConfig.PageSize, pageIndex);
        rpt_Refer.DataSource = dt;
        rpt_Refer.DataBind();

    }
}
